<div class="plan-detail">
    <div nz-form-item nz-row style="margin-top:15px;margin-bottom:10px;">
        <div nz-col [nzSpan]="6">
            <button nz-button [nzType]="'primary'" [nzSize]="'small'" col-offset-2 (click)="toBack()">
                <i class="anticon anticon-left"></i>
                <span>返回</span>
            </button>
        </div>
    </div>
    <nz-collapseset>
        <nz-collapse [nzTitle]="panels.name" [nzActive]="panels.active" [nzDisabled]="panels.disabled">
            <form nz-form [nzLayout]="'inline'">
                <div style="margin-bottom: 12px" nz-row>
                    <div nz-form-label nz-col [nzSpan]="3">
                        <label>单位名称</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="4">
                        <nz-input [(ngModel)]="planDetail.beCkedPartyName" name="beCkedPartyName">
                        </nz-input>
                    </div>

                    <div nz-form-label nz-col [nzSpan]="3">
                        <label>计划状态</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="4">
                        <nz-select style="width: 150px;" nzAllowClear [nzPlaceHolder]="'请选择'" [(ngModel)]="planDetail.checkState"
                            [nzShowSearch]="true" name="checkState">
                            <nz-option *ngFor="let option of checkStateList" [nzLabel]="option.label" [nzValue]="option.value"></nz-option>
                        </nz-select>
                    </div>
                    <button nz-button nz-col [nzSpan]="2" [nzSize]="'large'" [nzType]="'primary'" (click)="query()">查询</button>
                </div>

                <div style="margin-bottom: 8px" nz-row>
                    <div nz-form-label nz-col [nzSpan]="3">
                        <label>检查人</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="4">
                        <nz-input [(ngModel)]="planDetail.rsponUserName" name="rsponUserName">
                        </nz-input>
                    </div>

                    <div nz-form-label nz-col [nzSpan]="3">
                        <label>检查时间</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="9">
                        <nz-datepicker [nzSize]="'large'" [nzFormat]="'YYYY-MM-DD'" [(ngModel)]="planDetail.startDate"
                            name="startDate" [nzPlaceHolder]="'开始日期'"></nz-datepicker>
                        至
                        <nz-datepicker [nzSize]="'large'" [nzFormat]="'YYYY-MM-DD'" [(ngModel)]="planDetail.endDate"
                            name="endDate" [nzPlaceHolder]="'结束日期'"></nz-datepicker>
                    </div>
                </div>
            </form>
        </nz-collapse>
    </nz-collapseset>
    <ul nz-menu [nzMode]="'horizontal'">
        <li nz-menu-item (click)="add(title, content, footer, '1')">
            <i class="anticon anticon-plus"></i>向单位下达任务工单
        </li>
        <li nz-menu-item (click)="add(title, content, footer, '2')">
            <i class="anticon anticon-plus"></i>向个人下达任务工单
        </li>
        <li nz-menu-item (click)="update(title, content, footer)">
            <i class="anticon anticon-copy"></i>修改
        </li>
        <li nz-menu-item (click)="delete()">
            <i class="anticon anticon-delete"></i>删除
        </li>
        <!-- <li nz-menu-item>
            <i class="anticon anticon-copy"></i>导出
        </li> -->
    </ul>
    <nz-table #nzTable [nzDataSource]="list" nzSize="middle" [nzBordered]="true" [nzIsPagination]="false"
        (nzDataChange)="displayDataChange($event,'2')">
        <thead nz-thead>
            <tr>
                <th nz-th [nzCheckbox]="true">
                    <label nz-checkbox [(ngModel)]="allChecked" [nzIndeterminate]="indeterminate" (ngModelChange)="checkAll($event,'2')">
                    </label>
                </th>
                <th nz-th>
                    <span>单位名称</span>
                </th>
                <th nz-th>
                    <span>单位类型</span>
                </th>
                <th nz-th>
                    <span>牵头单位</span>
                </th>
                <th nz-th>
                    <span>计划实施时间</span>
                </th>
                <!--<th nz-th>
                <span>检查时间</span>
                </th>-->
                <th nz-th>
                    <span>检查人员</span>
                </th>
                <!--<th nz-th>
                <span>记录人员</span>
                </th>
                <th nz-th>
                <span>执法文书编号</span>
                </th>-->
                <th nz-th>
                    <span>计划状态</span>
                </th>
                <th nz-th>
                    <span>调整实施时间</span>
                </th>
                <th nz-th>
                    <span>调整原因</span>
                </th>
                <th nz-th *ngIf="showFlag">
                  <span>添加电梯</span>
                </th>
            </tr>
        </thead>
        <tbody nz-tbody>
            <tr nz-tbody-tr *ngFor="let data of list">
                <td nz-td [nzCheckbox]="true">
                    <label nz-checkbox [nzDisabled]="data.disabled" [(ngModel)]="data.checked" (ngModelChange)="refreshStatus($event,'2')">
                    </label>
                </td>
                <td nz-td *ngIf="data.pro_count && data.be_cked_party_name.indexOf('(')==-1 && data.program_name" style="color:deepskyblue;">{{data.be_cked_party_name}}（{{data.program_name}}）</td>
                <td nz-td *ngIf="data.pro_count && data.be_cked_party_name.indexOf('(')==-1 && !data.program_name" style="color:deepskyblue;">{{data.be_cked_party_name}}</td>
                <td nz-td *ngIf="!data.pro_count || data.be_cked_party_name.indexOf('(')!=-1">{{data.be_cked_party_name}}</td>
                <td nz-td>{{data.be_party_type}}</td>
                <td nz-td>{{data.rspon_party_name}}</td>
                <td nz-td>{{(planDict.pStartDt | dateFormat)+" 至 "+(planDict.pEndDt | dateFormat)}}</td>
                <td nz-td>{{data.rspon_user_name}}</td>
                <td nz-td>{{data.check_state | constantTransfer:config.checkStateList}}</td>
                <td nz-td>{{data.adj_date | dateFormat}}</td>
                <td nz-td>{{data.adj_reason}}</td>
                <td nz-td *ngIf="showFlag">
                  <button nz-button [nzType]="'small'" (click)="addElevator(titleElevator,contentElevator,footerElevator,data)">添加</button>
                  <button nz-button [nzType]="'small'" (click)="checkElevator(data.planDetailId)">查看</button>
                </td>
            </tr>
        </tbody>
    </nz-table>

    <nz-pagination [nzPageIndex]="planDetail.currentPage" nzShowTotal [nzTotal]="total" nzShowSizeChanger
        (nzPageSizeChange)="nzPageSizeChange($event,'2')" (nzPageIndexChange)="nzPageIndexChange($event,'2')"
        (nzPageIndexClickChange)="nzPageIndexClickChange($event,'2')" [nzPageSize]="planDetail.pageSize"></nz-pagination>


    <ng-template #title>
        <span>{{modelTitle}}</span>
    </ng-template>
    <ng-template #content>
        <plan-detail-publish *ngIf="modal==0" [inValue]="updateData" (outPut)="addOutPut($event)"></plan-detail-publish>
        <plan-detail-mod *ngIf="modal==1" [inValue]="updateData" (outPut)="addOutPut($event)"></plan-detail-mod>
    </ng-template>
    <ng-template #footer>
        <div>
        </div>
    </ng-template>


    <ng-template #title1>
        <span>请选择电梯安全日常监督检查计划</span>
    </ng-template>
    <ng-template #content1>
        <div>
            导入计划明细：
            <nz-upload nzAction="{{config.IP+config.API.uploadPlanDetail}}" [nzData]="inDictData" (nzChange)="uploadChage($event)"
                [nzShowUploadList]="false">
                <button nz-button>
                    <i class="anticon anticon-upload"></i>
                    <span>导入</span>
                </button>
            </nz-upload>
        </div>
    </ng-template>
    <ng-template #footer1>
        <div>
        </div>
    </ng-template>

  <!--添加电梯 start -->
  <nz-modal [ngClass]="addElevator">
    <ng-template #titleElevator>
      <span>{{modelTitle}}</span>
    </ng-template>
    <ng-template #contentElevator>
      <nz-collapseset>
        <nz-collapse [nzTitle]="panels.name" [nzActive]="panels.active" [nzDisabled]="panels.disabled">
          <form nz-form>
            <div nz-form-item nz-row>
              <div nz-form-label nz-col [nzXs]="2">
                <label>电梯类型</label>
              </div>
              <div nz-form-control nz-col [nzSpan]="4">
                <nz-select [nzMode]="'multiple'" nzAllowClear [nzPlaceHolder]="'请选择'" [nzShowSearch]="true"  [nzSize]="'small'"
                           [(ngModel)]="elevatorTypeParam" name="elevatorTypeId" [disabled]="false">
                  <nz-option *ngFor="let item of elevatorTypes" [nzLabel]="item.label" [nzValue]="item.value"></nz-option>
                </nz-select>
              </div>

              <div nz-form-label nz-col [nzXs]="2">
                <label>梯龄</label>
              </div>
              <div nz-form-control nz-col [nzSpan]="4">
                <nz-select [nzMode]="'multiple'"
                           nzAllowClear [nzPlaceHolder]="'请选择'" [(ngModel)]="elevatorAgeParam" [nzShowSearch]="true"
                           name="elevatorAgeParam">
                  <nz-option [nzLabel]="'10年以下'" [nzValue]="0">
                  </nz-option>
                  <nz-option [nzLabel]="'10~15(年)'" [nzValue]="1">
                  </nz-option>
                  <nz-option [nzLabel]="'15~20(年)'" [nzValue]="2">
                  </nz-option>
                  <nz-option [nzLabel]="'20年以上'" [nzValue]="3">
                  </nz-option>
                </nz-select>
              </div>

              <div nz-form-label nz-col [nzXs]="2">
                <label>电梯编号</label>
              </div>
              <div nz-form-control nz-col [nzSpan]="4">
                <nz-input [nzPlaceHolder]="'请输入'" [(ngModel)]="elevatorInfo.elevatorNum" name="planName">
                </nz-input>
              </div>
              <button style="margin-left: 50px"  nz-button  [nzType]="'primary'" (click)="queryElevator(tempPlanDetail)">查询</button>
              <button style="margin-left: 20px"  nz-button   [nzType]="'primary'" (click)="saveElevators()">保存</button>
            </div>
          </form>
        </nz-collapse>
      </nz-collapseset>
      <nz-table #nzTable [nzDataSource]="elevatorList" nzSize="middle" [nzBordered]="true" [nzIsPagination]="false" (nzDataChange)="displayDataChange($event,'1')">
        <thead nz-thead>
        <tr>
          <th nz-th [nzCheckbox]="true">
            <label nz-checkbox [(ngModel)]="eleAllChecked" [nzIndeterminate]="eleIndeterminate" (ngModelChange)="checkAll($event,'1')">
            </label>
          </th>
          <th nz-th>
            <span>电梯编码</span>
          </th>
          <th nz-th>
            <span>电梯类型</span>
          </th>
          <th nz-th>
            <span>电梯维保单位</span>
          </th>
          <th nz-th>
            <span>电梯使用单位</span>
          </th>
        </tr>
        </thead>
        <tbody nz-tbody>
        <tr nz-tbody-tr *ngFor="let data of elevatorList">
          <td nz-td [nzCheckbox]="true">
            <label nz-checkbox [nzDisabled]="data.disabled" [(ngModel)]="data.checked" (ngModelChange)="refreshStatus($event,'1')">
            </label>
          </td>
          <td nz-td>{{data.elevatorNum}}</td>
          <td nz-td>{{data.typeName}}</td>
          <td nz-td>{{data.maintenancePartyName}}</td>
          <td nz-td>{{data.usedPartyName}}</td>
        </tr>
        </tbody>
      </nz-table>
      <nz-pagination [nzPageIndex]="currentPage" nzShowTotal [nzTotal]="elevatorTotal" nzShowSizeChanger
                     (nzPageSizeChange)="nzPageSizeChange($event,'1')" (nzPageIndexChange)="nzPageIndexChange($event,'1')"
                     (nzPageIndexClickChange)="nzPageIndexClickChange($event,'1')" [nzPageSize]="pageSize"></nz-pagination>
    </ng-template>
    <ng-template #footerElevator>
      <div style="text-align:center">
        <!--电梯添加后，点击提交保存-->
        <button style="margin-left: 50px" nz-button  [nzType]="'primary'" (click)="clear()">清除</button>
        <button style="margin-left: 20px" nz-button  [nzType]="'primary'" (click)="submit()">提交</button>
      </div>
    </ng-template>
  </nz-modal>

</div>
